'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 联盟BOSS配置
 * @author agl
 */

var _ = require('lodash');
var moment = require('moment');
var dataApi = require('../libs/dataApi');

/**
 * 读取联盟BOSS配置
 */
exports.getUnionBossConf = function (boss_id) {
    return dataApi.union_boss.find({
        id: boss_id
    });
};

/**
 * 取出第一个联盟BOSS配置信息
 */
exports.getFirstBossConf = function () {
    var first_conf = dataApi.union_boss.find(function () {
        return true;
    });
    return first_conf;
};

/**
 * 取出下一个BOSS配置信息
 */
exports.getNextBossConf = function (boss_id) {
    return dataApi.union_boss.find(function (item) {
        return item.id > boss_id;
    });
};

/**
 * 取出排名奖励信息
 */
exports.getRankRewardInfo = function (rank) {
    var rank_conf = dataApi.union_boss_rank.find(function (item) {
        return item.min_rank <= rank && rank <= item.max_rank;
    });

    if (!rank_conf) {
        return null;
    }

    var reward_info = dataApi.union_boss_rank_reward.findById(rank_conf.id);
    return reward_info;
};

/**
 * 取出最后击杀BOSS奖励
 */
exports.getLastKillReward = function (boss_id) {
    return dataApi.union_boss_kill_reward.findById(boss_id);
};

/**
 * 取出联盟击杀BOSS奖励
 */
exports.getKillBossMemberReward = function (boss_id) {
    return dataApi.union_boss_member_reward.findById(boss_id);
};

/**
 * 取出累计伤害奖励信息
 */
exports.getTotalDamageReward = function (total_damage) {
    return dataApi.union_boss_hurt_reward.findById(total_damage);
};
